attribute vec4 vPosition;
uniform mat4 uMVPMatrix;
uniform mat4 uTMatrix;
uniform float age;
uniform float fadeinTimeout;
uniform float fadeinDuration;
uniform float fadeoutDuration;
uniform int vAlive;
varying float intensity;
void main() {
    gl_Position = uMVPMatrix * (uTMatrix * vPosition);
    if (vAlive > 0) {
    	if (fadeinTimeout < 1.0 && fadeinDuration < 1.0) {
    		intensity = 1.0;
    	} else {
    		intensity = smoothstep(fadeinTimeout, fadeinDuration, age);
    	}
    } else {
        intensity = smoothstep(0.0, fadeoutDuration, age);
    }
}